
<html style="width: 100%;height: 100%;">
    <head>
          <meta http-equiv="content-type" content="text/html;charset=utf-8">
          <title>
            申请详情填写
          </title>
    </head>
    <script src="/approval/static/js/jquery-3.4.1.min.js"></script>
    <script src="/approval/static/js/vue-2.4.0.js"></script>
    <link type="text/css" rel="stylesheet" href="/approval/static/css/bootstrap.min.css"/>
    <body style="width: 100%;height: 100%;">
        <script>
            $(document).ready(function (){
                var account=sessionStorage.getItem("account");
                var app=new Vue({
                    el:"#app",
                    data:{
                        processname:"",
                        opinion: "",
                        account:account
                    },
                    methods:{
                        bt_add:function (){
                            if (this.processname==""){
                                alert("项目名称不能为空！");
                            }else if (this.opinion==""){
                                alert("意见不能为空");
                            }else if (this.account==""){
                                alert("当前账户没有登录");
                            }else {
                                alert(this.processname+this.account+this.opinion)
                               $.ajax({
                                   url:"/approval/records/add",
                                   data: {
                                       processname:this.processname,
                                       opinion: this.opinion,
                                       account:this.account
                                   },
                                   async:false,
                                   dataType:"text",
                                   success:function (res){
                                       if (res=="true"){
                                           alert("添加成功");
                                           window.location="/approval/static/html/ApprovalDetail.html";

                                       }else {
                                           alert("添加失败！请检察信息");
                                       }
                                   }

                               })

                            }

                        }

                    }


                })

            })
        </script>

        <div class="container" style="width: 40%; margin-left: 30%;height: 100%; " id="app">
            <div class="panel panel-default">
                <div class="panel-body" style="padding: 0px;height: 100%">
                    <div class="form-group">
                                <label for="approcessname">审批名称</label>
                                <select class="form-control" id="approcessname" v-model="processname">
                                    <option disabled value="">请选择</option>
                                <option>项目申请</option>
                                <option>生活补贴</option>
                                </select>
                    </div><br/><br/><br/>
                    <div class="form-group">
                                <label for="opinion">申请理由</label>
                                <textarea class="form-control" rows="3" id="opinion" v-model="opinion"></textarea>
                    </div><br/><br/><br/>
                    <div class="text-center">
                    <button type="button" class="btn btn-success btn-lg" @click="bt_add">申请</button>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>